home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / cpp_libs / lin_alg.lha / lin_alg / myenv.cc < prev    next >
C/C++ Source or Header  |  1993-08-08  |  2KB  |  73 lines

  1. // This may look like C code, but it is really -*- C++ -*-
  2. /*
  3.  ************************************************************************
  4.  *            Service C++ functions 
  5.  *         that support the standard environment for me
  6.  */
  7.  
  8. #pragma implementation
  9.  
  10. #include "myenv.h"
  11. #include <builtin.h>
  12. #include <stdarg.h>
  13.  
  14.             // The following line is needed only for
  15.             // the stupid BSD 4.3
  16. #define vfprintf(fp,format,arg) _doprnt(format,arg,fp)
  17.  
  18. /*
  19.  *-----------------------------------------------------------------------
  20.  *        Some global constant pertaining to input/output
  21.  */
  22.  
  23. const char _Minuses [] = "\
  24. -------------------------------------------------------------------------------";
  25.  
  26. const char _Asteriscs [] = "\
  27. *******************************************************************************";
  28.  
  29. const char _Equals [] = "\
  30. ===============================================================================";
  31.  
  32.  
  33. /*
  34.  *------------------------------------------------------------------------
  35.  *            Print an error message at stderr and abort
  36.  * Synopsis
  37.  *    volatile void _error(const char * message,... );
  38.  *    Message may contain format control sequences %x. Items to print 
  39.  *    with the control sequences are to be passed as additional arguments to
  40.  *    the function call.
  41.  */
  42.  
  43. volatile void _error(const char * message,...)
  44. {
  45.   va_list args;
  46.   va_start(args,message);        /* Init 'args' to the beginning of */
  47.                     /* the variable length list of args*/
  48.   fprintf(stderr,"\n_error:\n");     
  49.   vfprintf(stderr,message,args);
  50.   fputs("\n",stderr);
  51.   abort();
  52. }
  53.  
  54.  
  55. /*
  56.  *------------------------------------------------------------------------
  57.  *                    Print a message at stderr
  58.  * Synopsis
  59.  *    void message(const char * text,... );
  60.  *    Message may contain format control sequences %x. Items to print 
  61.  *    with the control sequences are to be passed as additional arguments to
  62.  *    the function call.
  63.  */
  64.  
  65. void message(const char * text,...)
  66. {
  67.   va_list args;
  68.   va_start(args,text);        /* Init 'args' to the beginning of */
  69.                     /* the variable length list of args*/
  70.   vfprintf(stderr,text,args);
  71. }
  72.  
  73.